let fetch = require("../../utils/fetch");
let mta = require('../../utils/mta_analysis.js');
let app = getApp();
Page({
	data: {
		num: '',
		logoList: [],
		mgs: '专享折扣&下单奖励',
		urlAddress: getApp().globalData.imageUrl

	},

	onLoad: function(options) {

	},

	onReady: function() {
		console.log('onReady')
	},
	onShow: function() {
		this.getMaiXiangLogo();
		this.getMaiXiangInfo();

	},
	onHide: function() {},
	onUnload: function() {

	},
	getMaiXiangLogo: function() {
		var _self = this;
		wx.request({
			url: getApp().globalData.baseUrl + '/applet/maixiang/getPrivilegeLogo.do',
			header: getApp().globalData.header,
			success: function(res) {
				if (res.data.code == 200) {
					console.log("****3****")
					console.log(res)
					_self.setData({
						logoList: res.data.obj
					})

				} else {

				}
			}
		})
	},
	getMaiXiangInfo: function() {
		var _self = this;
		wx.request({
			url: getApp().globalData.baseUrl + '/applet/maixiang/checkMaiXiang.do',
			data: {
				shopCode: getApp().globalData.common.shopCode,
			},
			header: getApp().globalData.header,
			success: function(res) {
				if (res.data.code == 200) {
					console.log(res.data.obj)
					_self.setData({
						num: res.data.obj.discount * 100 / 10
					})
				} else {
					//非200
				}
			},
			fail: function() {
				//非网络错误
			}
		})
	}



})